﻿using EPE.Model;
using Fluent;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace EPE.WPF
{
    /// <summary>
    /// FluentMainForm.xaml 的交互逻辑
    /// </summary>
    public partial class FluentMainForm : RibbonWindow
    {
        CLoginUser userinfo;
        public FluentMainForm()
        {
            InitializeComponent();

            this.Hide();
            LoginForm lg = new LoginForm();
            lg.ShowDialog();
            if (lg.LoginOk)
            {
                userinfo = lg.LoginUserInfo;
                lg.Close();

                //InitForm(userinfo);
                this.Show();
                this.Focus();
                //dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
                //dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
                //dispatcherTimer.Start();
            }
            else
            {
                this.Close();
            }

        }

        private void btnUser_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCUserList ulist = new UCUserList();

                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(ulist);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }

        private void btnLog_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCLogList ulist = new UCLogList();

                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(ulist);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }


        private void btnPassword_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCPassWord upw = new UCPassWord();

                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(upw);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }


        private void btnPrinter_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCPrinter pl = new UCPrinter();
                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(pl);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }

        private void btnDepartmentInfo_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCDepartmentInfoList ucd = new UCDepartmentInfoList();
                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(ucd);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }

        private void btnProject_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCProjectList ucpj = new UCProjectList(userinfo);
                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(ucpj);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }

        private void btnRole_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCRoleList ucrl = new UCRoleList();
                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(ucrl);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }

        private void btnShops_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCShopsList ucs = new UCShopsList(userinfo);
                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(ucs);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }

        private void btnBuild_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCBuildList ucb = new UCBuildList(userinfo);
                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(ucb);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }

        private void btnPara_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCShopsPriceSystemList usp = new UCShopsPriceSystemList(userinfo);
                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(usp);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }

        private void btnHousePara_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCHousePriceSystemList usp = new UCHousePriceSystemList();
                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(usp);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }

        private void btnHouseProjectt_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCHouseProjectList usp = new UCHouseProjectList();
                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(usp);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }

        private void btnHouseBuild_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCHouseBuildList usp = new UCHouseBuildList();
                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(usp);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }

        private void btnHouse_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UCRoomList usp = new UCRoomList();
                this.cvMain.Children.Clear();
                this.cvMain.Children.Add(usp);
            }
            catch (Exception ex)
            {
                //logPrint.Error(ex.ToString());
            }
        }


    }
}
